package com.heima.utils.common;

import java.util.Random;

/**
 * @author 21236
 */
public class CaptchaUtil {

    private static final String CHARACTERS = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
    private static final int LENGTH = 6;

    public static String getCharacters() {
        Random random = new Random();
        StringBuilder captcha = new StringBuilder(LENGTH);
        for (int i = 0; i < LENGTH; i++) {
            captcha.append(CHARACTERS.charAt(random.nextInt(CHARACTERS.length())));
        }
        return captcha.toString();
    }
}
